﻿namespace WebPacker.Filters
{
	using System;
	using WebPacker.Packs;
	using Yahoo.Yui.Compressor;

	public sealed class YuiCssMinifier : IFilter
	{
		public YuiCssMinifier()
		{
			ColumnWidth = -1;
			CompressionType = CssCompressionType.StockYuiCompressor;
		}

		public string Name { get; set; }

		public CssCompressionType CompressionType { get; set; }

		public int ColumnWidth { get; set; }

		public PackType	PackType
		{
			get { return PackType.Css; }
		}

		public string Apply(string content)
		{
			if (content == null)
			{
				throw new ArgumentNullException("content");
			}

			return content;
		}

		public string ApplyToCombined(string combinedContent)
		{
			return CssCompressor.Compress(combinedContent, ColumnWidth, CompressionType);
		}
	}
}
